/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "GAR_ESTADO_GARANTIA")
@NamedQueries({@NamedQuery(name = "EstadoGarantia.findAll", query = "SELECT e FROM EstadoGarantia e"), @NamedQuery(name = "EstadoGarantia.findByIdEstadoGarantia", query = "SELECT e FROM EstadoGarantia e WHERE e.idEstadoGarantia = :idEstadoGarantia"), @NamedQuery(name = "EstadoGarantia.findByNombre", query = "SELECT e FROM EstadoGarantia e WHERE e.nombre = :nombre")})
public class EstadoGarantia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_ESTADO_GARANTIA", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idEstadoGarantia;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 50)
    private String nombre;
    @JoinColumn(name = "FID_GAR_GARANTIA", referencedColumnName = "ID_GARANTIA", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Garantia fidGarGarantia;

    public EstadoGarantia() {
    }

    public EstadoGarantia(Long idEstadoGarantia) {
        this.idEstadoGarantia = idEstadoGarantia;
    }

    public EstadoGarantia(Long idEstadoGarantia, String nombre) {
        this.idEstadoGarantia = idEstadoGarantia;
        this.nombre = nombre;
    }

    public Long getIdEstadoGarantia() {
        return idEstadoGarantia;
    }

    public void setIdEstadoGarantia(Long idEstadoGarantia) {
        this.idEstadoGarantia = idEstadoGarantia;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Garantia getFidGarGarantia() {
        return fidGarGarantia;
    }

    public void setFidGarGarantia(Garantia fidGarGarantia) {
        this.fidGarGarantia = fidGarGarantia;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEstadoGarantia != null ? idEstadoGarantia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EstadoGarantia)) {
            return false;
        }
        EstadoGarantia other = (EstadoGarantia) object;
        if ((this.idEstadoGarantia == null && other.idEstadoGarantia != null) || (this.idEstadoGarantia != null && !this.idEstadoGarantia.equals(other.idEstadoGarantia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.gar.be.EstadoGarantia[idEstadoGarantia=" + idEstadoGarantia + "]";
    }

}
